$('form').Validform({
				tiptype: function(msg, o, cssctl) {
					var $parent = o.obj.parent();
					var isHave = $parent.find(".msg").length>0;
					if(!isHave){
						var $msg = $('<div class="msg"></div>')
						$parent.append($msg);
					}
					//通过验证
					if(o.type == 2){
						$parent.find(".msg").remove();
					}
					//验证失败
					if(o.type == 3){
						$parent.find(".msg").text(msg);
						
					}
					
				}
			});


new PCAS("add-province", "add-city", "add-area");
$('.confirm-c-order-address-empty').click(function() {
	$('.add-pop-box-all').show();
})
$('.add-pop-box-close').click(function() {
	$('.add-pop-box-all').hide();
})
$('.add-pop-box-cancel').click(function() {
	$('.add-pop-box-all').hide();
})
$('.add-pop-box-ok').click(function() {
	var name = $('#consignee').val();
	var phone = $('#telphone').val();
	var province = $('#add-province option:selected').val();
	var city = $('#add-province option:selected').val();
	var area = $('#add-province option:selected').val();
	var position = $('.add-pop-box-address textarea').val().trim();
	$('<li class="address-border"><div class="confirm-c-order-address-add-main"><p class="clear-fix"><b class="fl">' +
		name + '</b><span class="fr">' + phone +
		'</span></p><div class="confirm-c-order-address-add-main-detail"> ' + province + ' ' + city + ' ' +
		area +
		' '+position+'</div></div><div class="confirm-c-order-address-sub clear-fix"><a href="javascript:;" class="confirm-c-order-address-edit">编辑</a><a href="javascript:;"class="confirm-c-order-address-del">删除</a></div></li>'
		).insertBefore('.confirm-c-order-address-empty-all');
		$('form')[0].reset();
		$('.add-pop-box-all').hide();	
})
$('.confirm-c-order-address-add').on('click','.confirm-c-order-address-edit',function(){
	var name = $(this).parents('.address-border').find('b').text();
	var phone = $(this).parents('.address-border').find('p').children('span').text();
	$('.add-pop-box-all').show();
	$('#consignee').val(name);
	 $('#telphone').val(phone)
	
})
$('.confirm-c-order-address-add').on('click','.confirm-c-order-address-del',function(){
	$(this).parents('.address-border').remove();
})
$('.cuopon-tab a').click(function(){
	$('.cuopon-tab a').removeClass('colorred');
	$('.cuopon-tab a span').removeClass('colorred');
	$('.cuopon-tab .red-line').removeClass('disblock').addClass('disnone');
	$(this).addClass('colorred');
	$(this).find('span').addClass('colorred');
	$(this).find('.red-line').removeClass('disnone').addClass('disblock');
})
